class Siteadmin::UsersController < ApplicationController
	before_filter :require_admin
	load_and_authorize_resource :through => :profile

	layout 'admin'
	active_scaffold :user do |config|    
		#config.columns[:role].ui_type = :select

		#All the possible columns that are active scafold can use. 
		config.columns = [:login,
			:password,
			:password_confirmation,
			:profile,
			#:fullname,
			#:image_url,
			#:birth_date,
			#:sex, 
			#:favorite_books,
			#:education_and_work,
			#:occupation,                      
			:login_count,
			:last_request_at,
			:current_login_at,
			#:enabled,
			#:verified,                      
			#:user_groups]
			:role]

		#Columns that are not shown in the list view                   
		list.columns.exclude [:crypted_password, 
			#:password_salt, 
			#:image_url,
			:last_login_at,
			:current_login_ip,
			:last_login_ip,
			:failed_login_count
		]

		config.create.columns = [:login,
			:password,
			:password_confirmation,
			:role]

		#Set which columns can be edited by the adminstrator                               
		config.update.columns = [#:login,
			#:password,
			#:password_confirmation,
			:role
		]           
	end

end
